package com.p2p.front.dal.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.p2p.base.dao.BaseMapper;
import com.p2p.front.dal.model.ChargeLogSummary;

/**
 * leiwen@yiqihao.com
 */
public interface ChargeLogSummaryDao extends BaseMapper {

	void add(ChargeLogSummary chargeLogSummary);

	@Update("update p2p_charge_log_summary set amount = amount + #{amount.cent},uptime=now() where uid=#{uid} and type=#{type}")
	void update(ChargeLogSummary chargeLogSummary);

	@Select("select * from p2p_charge_log_summary where uid=#{uid} and type=#{type} for update")
	@ResultMap("chargeLogSummaryResultMap")
	ChargeLogSummary selectForUpdate(@Param("uid")Long uid, @Param("type")String type);

	@Select("select * from p2p_charge_log_summary where uid=#{uid} and type=#{type}")
	@ResultMap("chargeLogSummaryResultMap")
	ChargeLogSummary get(@Param("uid")Long uid, @Param("type")String type);
}
